function [Frequency] = DetermineFrequencyInEpoch(Data, Window, Interval, StartIndex)
    
    EndIndex = StartIndex + Window/Interval;
    SwitchToPositive = 1;
    SwitchToNegative = 1;
    if Data(StartIndex) >= 0
        startPositive = 1;
        SwitchToNegative = 0;
    else
        startPositive = 0;
        SwitchToPositive = 0;
    end
    count = 0;
    %fprintf('Length : %d \n', length(Data));
    %fprintf('StartIndex : %d EndIndex : %d', StartIndex, EndIndex); 
    for i = StartIndex : EndIndex
        if Data(i) >= 0
            SwitchToNegative = 0;
            if startPositive == 0 && SwitchToPositive == 0
                count = count + 1;
                SwitchToPositive = 1;
            end
        else
            SwitchToPositive = 0;
            if startPositive == 1 && SwitchToNegative == 0
                count = count + 1;
                SwitchToNegative = 1;
            end
        end
        %fprintf('Length : %d \n', count);
    end
    Frequency = count/Window;
end

